package com.homework.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.homework.service.EvaluationService;
import com.opensymphony.xwork2.ActionSupport;

public class EvaluationGetAction extends ActionSupport implements ServletRequestAware{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7368472155614002357L;
	HttpServletRequest request = null;
	private EvaluationService EvaluationService;
	public Map<String, String> map = new HashMap<String, String>();

	public EvaluationGetAction()
	{
		EvaluationService = new EvaluationService();
	}


	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		request = arg0;
	}



	public String execute() {
		String homeworkId = request.getParameter("homeworkId");
		String homework = EvaluationService.getEvaluation(homeworkId);
		map.put("result", homework);
		return "success";
	}
}
